package com.yanqu.road.server.cmd.activity.curio;

import com.yanqu.road.entity.enums.eSystemId;
import com.yanqu.road.message.YanQuMessage;
import com.yanqu.road.pb.cangbao.CurioProto;
import com.yanqu.road.server.cmd.base.AbstractCommand;
import com.yanqu.road.server.command.Cmd;
import com.yanqu.road.server.gameplayer.GamePlayer;
import com.yanqu.road.server.manger.config.SystemOpenMgr;
import com.yanqu.road.server.protocol.GameErrorCode;
import com.yanqu.road.server.protocol.Protocol;

@Cmd(code = Protocol.S_CURIO_DRAW_NOTICE, desc = "淘宝公告")
public class GetCurioLotteryNoticeCmd extends AbstractCommand {

    @Override
    public boolean parseData(YanQuMessage packet) throws Exception {
        return true;
    }

    @Override
    public void execute(GamePlayer player, YanQuMessage packet) throws Exception {
        if(!SystemOpenMgr.systemOpen(player, eSystemId.Curio.getValue())){
            ret = GameErrorCode.E_SYSTEM_NO_OPEN;
            return;
        }
        player.sendPacket(Protocol.C_CURIO_LOTTERY_GET_NOTICE, CurioProto.GetCurioLotteryNoticeReqMsg.newBuilder());
    }

    @Override
    public void sendData(GamePlayer player) {
       if(ret != 0) {
           player.sendPacket(Protocol.U_CURIO_DRAW_NOTICE, CurioProto.GetCurioLotteryNoticeRespMsg.newBuilder().setRet(ret));
       }
    }
}
